IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[spDriver_UpdateDriver]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [dbo].[spDriver_UpdateDriver]
GO

GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Eric Liew
-- Create date: 6/2/2009
-- Description:	Get all drivers
-- =============================================
CREATE PROCEDURE [dbo].[spDriver_UpdateDriver]
(
		@DriverID INT,
		@Title VARCHAR(50),
		@FirstName VARCHAR(50),
		@LastName VARCHAR(50),
		@Street1 VARCHAR(50),
		@Street2 VARCHAR(50),
		@Suburb VARCHAR(50),
		@State VARCHAR(50),
		@Postcode VARCHAR(4),
		@Phone VARCHAR(10),
		@Mobile1 VARCHAR(10),
		@Mobile2 VARCHAR(10),
		@Licience VARCHAR(10),
		@DriverLicienceExpiry DATETIME,
		@TaxiLicience VARCHAR(10),
		@ABN VARCHAR(20),
		@DateOfBirth DATETIME,
		@CommencementDate DATETIME,
		@Nickname VARCHAR(50),
		@TaxiLicienceExpiry DATETIME,
		@ETagNumber VARCHAR(50),
		@ETagAccount VARCHAR(50),
		@Gender INT,
		@MonDayRate VARCHAR(50),
		@MonNightRate VARCHAR(50),
		@TuesDayRate VARCHAR(50),
		@TuesNightRate VARCHAR(50),
		@WedDayRate VARCHAR(50),
		@WedNightRate VARCHAR(50),
		@ThursDayRate VARCHAR(50),
		@ThursNightRate VARCHAR(50),
		@FriDayRate VARCHAR(50),
		@FriNightRate VARCHAR(50),
		@SatDayRate VARCHAR(50),
		@SatNightRate VARCHAR(50),
		@SunDayRate VARCHAR(50),
		@SunNightRate VARCHAR(50)
)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	UPDATE Driver
	SET Title = @Title,
		FirstName = @FirstName,
		LastName = @LastName,
		Street1 = @Street1,
		Street2 = @Street2,
		Suburb = @Suburb,
		State = @State,
		Postcode = @Postcode,
		Phone = @Phone,
		Mobile1 = @Mobile1,
		Mobile2 = @Mobile2,
		Licience = @Licience,
		DriverLicienceExpiry = @DriverLicienceExpiry,
		TaxiLicience = @TaxiLicience,
		ABN = @ABN,
		DateOfBirth = @DateOfBirth,
		CommencementDate = @CommencementDate,
		Nickname = @Nickname,
		TaxiLicienceExpiry = @TaxiLicienceExpiry,
		ETagNumber = @ETagNumber,
		ETagAccount = @ETagAccount,
		Gender = @Gender
	WHERE
	DriverID = @DriverID    
	
	UPDATE DriverRate
	SET MonDayRate = @MonDayRate,
		MonNightRate = @MonNightRate,
		TuesDayRate = @TuesDayRate,
		TuesNightRate = @TuesNightRate,
		WedDayRate = @WedDayRate,
		WedNightRate = @WedNightRate,
		ThursDayRate = @ThursDayRate,
		ThursNightRate = @ThursNightRate,
		FriDayRate = @FriDayRate,
		FriNightRate = @FriNightRate,
		SatDayRate = @SatDayRate,
		SatNightRate = @SatNightRate,
		SunDayRate = @SunDayRate,
		SunNightRate = @SunNightRate
	WHERE DriverRate.DriverId = @DriverID

 

END
GO
